package com.yxhl.zoume.core.busticket.view;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.bigkoo.convenientbanner.holder.Holder;
import com.squareup.picasso.Picasso;
import com.yxhl.zoume.R;

/**
 * Banner加载网络图片
 * <p>
 * Created by Xboy on 16/3/24.
 */
public class NetworkImageHolderView implements Holder<String> {
    private ImageView imageView;

    @Override
    public View createView(Context context) {
        imageView = new ImageView(context);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        return imageView;
    }

    @Override
    public void UpdateUI(Context context, int position, String data) {
        Picasso.with(context)
                .load(data)
                .placeholder(R.drawable.bg_banner_loading_placeholder)
                .error(R.drawable.bg_banner_error)
                .into(imageView);
    }
}
